Sub SQLdbClose()
'
' close open database
'
On Error Resume Next ' ignore errors here
'
db.Close
'
For x = 0 To intForms
Unload TblForms(x)
Next x
'
intForms = 0
intDBFlag = False
'
End Sub
The final routine to handle special commands is the routine that processes the DBMAKE keyword to create new Microsoft Access Jet databases. This one works much like the DBOPEN routine except that there are a few additional chores when creating a new file. Create a Public Sub called SQLdbMake and enter the code in Listing A.21.
Listing A.21. Coding the SQLdbMake routine.
Sub SQLdbMake()
'
' make a new database
'
On Error GoTo SQLdbMakeErr
'
Dim strMake As String
Dim intTemp As Integer
'
strLine = Trim(strLine) ' drop any spaces
intTemp = InStr(strLine, " ") ' locate first embedded space
strMake = Mid(strLine, intTemp + 1, 255) ' get rest of line
'
' if line ends w/ ";", dump it!
If Right(strMake, 1) = ";" Then
strMake = Left(strMake, Len(strMake) - 1)
End If
'
' try to open it (to see if it already exists)
nSQLMakeHandle = FreeFile(0)
Open strMake For Input As nSQLMakeHandle
Close nSQLMakeHandle
'
nResult = MsgBox("ERASE [" + strMake + "]", vbYesNo + vbQuestion, "Database Already Exists!")
If nResult = vbYes Then